package com.aokser.redisplugin.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 对象池配置 
 * @version 1.0
 * @author aokser@foxmail.com
 */
@Component
public class GenericObjectPoolConfig extends org.apache.commons.pool2.impl.GenericObjectPoolConfig{

	/**
	 * 基础配置对象
	 */
    @Autowired
    private BaseConfig baseConfig;

    public BaseConfig getBaseConfig() {
        return baseConfig;
    }

    public void setBaseConfig(BaseConfig baseConfig) {
        this.baseConfig = baseConfig;
    }

    @Override
    public void setMaxTotal(int maxTotal) {
        maxTotal = baseConfig.getMaxTotal();
        super.setMaxTotal(maxTotal);
    }

    @Override
    public void setMaxIdle(int maxIdle) {
        maxIdle = baseConfig.getMaxIdle();
        super.setMaxIdle(maxIdle);
    }

    @Override
    public void setMinIdle(int minIdle) {
        minIdle = baseConfig.getMinIdle();
        super.setMinIdle(minIdle);
    }

    @Override
    public void setMaxWaitMillis(long maxWaitMillis) {
        maxWaitMillis = baseConfig.getMaxWaitMillis();
        super.setMaxWaitMillis(maxWaitMillis);
    }
    
}
